package chat.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xkh.xkh.MyApplication;
import com.xkh.xkh.R;

import java.util.ArrayList;
import java.util.List;

import model.Room;

/**
 * Created by Administrator on 2016/3/29.
 */
public class RoomAdapter extends BaseAdapter {

    private List<Room> userRooms = new ArrayList<Room>();

    public void setUserRooms(List<Room> userRooms) {
        this.userRooms = userRooms;
    }

    @Override
    public int getCount() {
        return userRooms.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Room userRoom = userRooms.get(position);
        convertView = View.inflate(MyApplication.share(), R.layout.item_group,null);
        TextView tv_groupName = (TextView) convertView.findViewById(R.id.id_tv_groupName);
        tv_groupName.setText(userRoom.getRoom_Name());
        return convertView;
    }
}
